print("Введите скобочную последовательсть: ")
s=input()
s1=''
f=0
for char in s:
    print(s1)
    if char == '(' or char == '[' or char == '{' or char == '<':
        s1+=char
    else:
        if len(s1)>0:
            if s1[len(s1)-1]=='(' and char == ')' or \
               s1[len(s1)-1]=='[' and char == ']' or \
               s1[len(s1)-1]=='<' and char == '>' or \
               s1[len(s1)-1]=='{' and char == '}':
                s1=s1[:-1]
            else:
                f=1
        else:
            f=1
    
    if f==1:
        break
print(s1)
if f==0:
    print("True")
else:
    print("False")
